<% first_attachments = true

   name_attribute = attributes.delete_if {|attr| attr.name == 'name'}
   # Assumes every content block should always have a name attribute
-%><%%= f.input :name, as: :name %>
<% for attribute in attributes -%>
<%= field_tag = case attribute.type
        when :attachment
          "input :#{attribute.name}, as: :file_picker"
        when :attachments
          if first_attachments
            first_attachments = false
            "cms_attachment_manager"
          end
        when :category
          "association :#{attribute.name}, collection: categories_for('#{class_name.titleize}')"
        when :date
          "input :#{attribute.name}, as: :date_picker"
        when :html
          "input :#{attribute.name}, as: :text_editor"
        else
          "input :#{attribute.name}"
        end

   "<%= f.#{field_tag} %%>"
%>
<% end -%>